<!--# include Template('header'); #-->
<!--header----main-->
<style>
#home-feed-type {
	border-bottom:1px solid #C5D7E9;
	height:24px;
	margin:10px 0 10px;
}
#home-feed-type ul.list {
	float:left;
	margin-bottom:-1px;
	margin-left:5px;
}
#home-feed-type li {
	background:#D8E4F0 none repeat scroll 0 0;
	float:left;
	height:22px;
	margin:2px 5px 0 0;
	padding:0 1px;
}

#home-feed-type li a {
	display:block;
	padding:5px 10px;
	text-decoration:none;
}

#home-feed-type li.current {
	background:#FFFFFF none repeat scroll 0 0;
	border-left:1px solid #C5D7E9;
	border-right:1px solid #C5D7E9;
	border-top:1px solid #C5D7E9;
	height:24px;
	margin-top:0;
	padding:0;
}

#home-feed-type li.current a {
	color:#000000;
	padding-top:5px;
}

#home-feed-type li a:hover {
	background-color:#2E8AE6;
	color:#FFFFFF;
	text-decoration:none;
}

#home-feed-type li.current a:hover {
	background:#FFFFFF none repeat scroll 0 0;
	color:#000000;
}

</style>
<link rel="stylesheet" type="text/css" href="css/up.css" />
<script type="text/javascript" src="script/swfupload.js"></script>
<script type="text/javascript" src="script/photo/uploadhandlers.js"></script>
<script type="text/javascript" src="script/photo/fileupload.js"></script>
<script language="javascript" src="script/global.js"></script>
<script language="javascript" src="script/xhr.js"></script>
<SCRIPT type=text/javascript><!--
var i_flash;
var v_flash;
// Netscape 
if (navigator.plugins) {
	for (var i=0; i < navigator.plugins.length; i++) {
		if (navigator.plugins[i].name.toLowerCase().indexOf("shockwave flash") >= 0) {
		i_flash = true;
		v_flash = navigator.plugins[i].description.substring(navigator.plugins[i].description.toLowerCase().lastIndexOf("flash ") + 6, navigator.plugins[i].description.length);
	}
}
}
// -->
</SCRIPT>
<SCRIPT type=text/vbscript><!--
//IE
on error resume next
set f = CreateObject("ShockwaveFlash.ShockwaveFlash")
if IsObject(f) then
i_flash = true
v_flash = hex(f.FlashVersion())
end if
// -->
</SCRIPT> 

<SCRIPT type=text/javascript><!--
if (i_flash) {
//document.writeln("你已经安装了Flash插件")
if (v_flash && v_flash < 8) {
	alert("您的浏览器Flash插件版本 " + v_flash + "太低，请升级最新Flash版本");
} else {
	if(v_flash.indexOf('9.0') == -1)
	{
		//alert("您的浏览器Flash版本不是9.0，暂时无法使用上传功能。\\n请删除现有Flash版本然后安装Flash Player9.0版本。");
	}
}
} else {
	alert("您的浏览器没有安装Flash插件，请安装最新版本，否则将无法上传");
//document.writeln("你没有安装Flash插件")
}
// --></SCRIPT>
<div id="content">
  <div id="left">
	            <h2 id="step_descrip">
<!--#if($action=='edit'){#-->第一步：编辑{$very[contentName]}及所属文件<!--#}else{#--><span>第一步：填写{$very[contentName]}描述</span><span>第二步：上传{$very[contentName]}的文件</span><!--#}#-->
            </h2>
<!--#if($action=='edit'){#-->
<div id="home-feed-type">
<ul class="list">
<li class="current" id="editIntro"><a href="#" onmouseover="showEditArea('intro');" onclick="return false;">编辑说明{$very[contentName]}</a></li>
<li id="editRes"><a href="#" onmouseover="showEditArea('resource');" onclick="return false;">编辑已有文件</a></li>
</ul>
</div><!--#}#-->
		        <div id="photoupload" class="list" style="width:100%; margin:auto;">
          <div id="step0" style="display:">
		  <div id="intro">
          <form action="upload.php?action=$action" method="post" name="FORM" enctype="multipart/form-data" target="uploadFrame" onsubmit="return checkRes();">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr class="line">
                  <td>目录</td>
                  <td><select name="cid" id="mulu" onchange="document.getElementById('cateid').value = this.value;">
                      <option value="">请选择目录</option>  
		$cate_select                    
                    </select></td>
                </tr>
                <!--
EOT;
foreach($inputArea as $value){
print <<<EOT
-->
                <tr class="line">
                  <td>$value[fieldname]</td>
                  <td>$value[input]</td>
                </tr>
                <!--
EOT;
}print <<<EOT
-->
				<tr class="line">
				<td>{$very[contentName]}是否公开</td>
				<td><input name="ifprivate" type="radio" value="0" $private_N />
				共享
				  <input name="ifprivate" type="radio" value="1" $private_Y /> 
				  私密 （私有{$very[contentName]}只有自己能够查看） </td>
				</tr>
                <tr class="line">
                  <td>当前标签</td>
                  <td><span style="float:right; padding-right:90px;">点击可删除标签</span>
                    <input name="tagsid" type="hidden" value=",$tagsid" />
                    <span id='tags_show'>$tags </span></td>
                </tr>
                <tr class="line">
                  <td>添加标签</td>
                  <td><span style="float:right; padding-right:70px;">多个标签可用空格区分</span>
                    <input type="text" name="tags" id="tags" class="input" size="40" onkeyup="SearchTag(event);" />
                    <input type="button" name="Submit3" value="点击添加" class="btn" onclick="addtag();" />
                    <div id="showtags" class="showtags"></div></td>
                </tr>
              </table>
              <div style="height:50px; text-align:center">
                <input name="step" type="hidden" id="step" value="2" />
                <input name="tid" type="hidden" id="tid" value="$tid" />
                <input type="submit" name="Submit" value="下一步" class="button" />
                <input type="reset" name="Submit2" value="重置" class="button" />
              </div>
            </form>
			</div>
<!--#if($action=='edit'){#-->
<div id="resource" style="display:none;">
<form action="upload.php?action=rename" method="post" target="uploadFrame" name="mul" id="mul">
<div id="resList">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody id="resourceTbody">
<tr id="listtitle">
    <td width="4%"><input type="checkbox" name="checkbox" value="checkbox" onclick="CheckAll(document.getElementById('mul'));" /></td>
    <td width="35%" style="text-align:center">标题</td>
    <td width="45%" style="text-align:center">原始文件名</td>
    <td width="12%" style="text-align:center">文件大小</td>
	<td width="4%">&nbsp;</td>
  </tr>
<!--#foreach($fileList as $r){#-->
  <tr class="line" id="res_{$r[rid]}">
  	<td><input name="delrid[]" type="checkbox" id="delrid[]" value="$r[rid]" /></td>
    <td><input type="text" class="input" value="$r[filetitle]" size="30" id="filetitle_$r[rid]" name="filetitle[{$r[rid]}]" />
    <a href="javscript:;" onclick="return saveTitle($r[rid]);"></a></td>
	<td>$r[filename]</td>
	<td>$r[filesize]</td>
	<td><a href="javascript:void(0);" onclick="removeRes('$r[rid]');"><img src="images/admin/delete.png" align="absmiddle" title="删除此资源" /></a></td>
  </tr>	
<!--#}#-->
</tbody>
</table>
</div>
<div style="text-align:center; padding:10px;">
  <input name="tid" type="hidden" id="tid" value="$tid" />
<input type="submit" class="button" value="批量命名" onclick="return mulRename();" />
<input type="button" class="button" value="批量删除" onclick="return mulDelete();" />
</div>
</form>
</div>
<!--#}#-->
          </div>
          <div class="box" id="upfile" style="display:none;">
<div class="WarningMsg">本系统挂载了视频转码模块，您所上传的视频将会自动转码，转码耗时视视频格式而定。</div>
		  <h3><img src="images/icon/upload.png" align="absmiddle" />
<!--# if($action == 'add'){#-->		  
{$very[contentName]}描述已保存，下面您可以上传相应文件，按住Ctrl键可同时选择多个文件。
<!--# }else{#-->
{$very[contentName]}已经编辑成功，您现在可以上传更多的文件到此{$very[contentName]}下。
<!--#}#-->		   
		   </h3>
            <div id="uperror"></div>
            <form action="upload.php" method="post" id="upload" name="upload">
              <div class="uploadControl">
                <button type="button" id="openFileWin">批量上传文件</button>   
                
              </div>
              <div id="upstatus">
                <div id="uptext">正在上传，请不要关闭本窗口</div>
                <div class="clearfix" id="up-pro">
                  <div class="soildbd fL" id="up-progress-wrapper">
                    <div id="up-progress" style="width:0%;"></div>
                  </div>
                  <input type="button" id="cancelup"/>
                </div>
                <div id="upspeed"> <b></b> 上传进度：<span id="percent">0%</span>
                  <!--
							<span id="time">剩余时间：00：26秒</span>
							<span id="speed">目前速度：1256KB/s</span>
							-->
                </div>
              </div>
              <div id="donestatus">文件已成功上传，您可以点击”批量上传“来上传更多的文件。 </div>
              <!--list-->
              <div id="step2">
			  <div id="newfile">
			  <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody id="photolist">
<tr class="listtitle"><td>文件标题</td><td>原始文件名</td></tr>
</tbody></table>
</div>
               <!-- <ul id="photolist" class="clearfix">
                </ul>-->
              </div>
              <!--list end-->
              <!--up-->
			  <div style="clear:both; height:10px;"></div>
              <div id="step3" style="text-align:center">
                <input type="submit" name="upbtn" id="upbtn"  value="批量命名文件" class="button" />
				<input type="button" name="complete" id="complete"  value="结束上传" class="button" onclick="window.location='my.php?action=upload';" />
                <input type="hidden" name="cateid" id="cateid" value="$defaultcid"/>
              </div>
              <!--up end-->
            </form>
          </div>
        </div>
        <div style="clear:both"></div>
  </div>
  <!--# include Template('sidebar-flash'); #-->
</div>
<iframe name="uploadFrame" width="0" height="0" style="visibility:hidden"></iframe>
<div class="clear"></div>
<script language="javascript" src="script/jquery-1.2.1.pack.js"></script>
<script language="javascript">
function showEditArea(val)
{
	if(val == 'resource')
	{
		$("#resource").show();
		$("#intro").hide();
		$("#editRes").attr("class",'current');
		$("#editIntro").attr('class','');
	}
	else
	{
		$("#resource").hide();
		$("#intro").show();
		$("#editIntro").attr('class','current');
		$("#editRes").attr("class",'');
	}
	
}

function mulDelete()
{
	var form = document.getElementById('mul');
	if(!confirm("您确认要删除这些文件吗？"))
	{
		return false;
	}
	form.action="upload.php?action=muldelete";
	form.submit();
}

function mulRename()
{
	var form = document.getElementById('mul');
	form.action="upload.php?action=rename";
}

ifcheck = true;
function CheckAll(form)
{
	for (var i=0;i<form.elements.length-2;i++)
	{
		var e = form.elements[i];
		if(e.type=='checkbox') e.checked = ifcheck;
	}
	ifcheck = ifcheck == true ? false : true;
}

var selectCheck = 0;
function whole(form)
{
	for (var i=0;i<form.elements.length-2;i++)
	{
		var e = form.elements[i];
		if(e.type=='checkbox'){
			if(e.checked==true) selectCheck++;
		}
	}
	if(selectCheck<=0){
		alert("请选择操作对象");
		return false;
	}
}

var _debug = {};
var photo_swfu = '';
<!--# if($action == 'edit'){#-->
var tid=$tid;

function editContent()
{
	var c = confirm("您已经成功的编辑了{$very[contentName]}信息，您要接着上传更多的文件到本{$very[contentName]}下吗？\\n点击确定上传更多文件，点击取消直接完成修改。");
	if (c)
	{
	
		document.getElementById("step0").style.display = "none";
		document.getElementById("upfile").style.display = "block";
		$("#step_descrip").html("第二步：添加更多的文件");
		objectSWF(tid);
	}
	else
	{
		window.location = 'my.php?action=upload';
		return;
	}
}
<!--#}#-->
function saveTitle(rid)
{
	var title = document.getElementById('filetitle_'+rid).value;
	var url = 'upload.php?action=edittitle&rid=' + rid + '&title=' + title + '&tid=' + tid;
	var xhr = new XHR("saveTitleOK");
	//alert(title);
	xhr.post(url);
	return false;
}

function saveTitleOK(res)
{
	if(res == '100')
	{
		alert("文件标题修改成功");
	}
	else
	{
		alert(res);
	}
}

function objectSWF(tid)
{
	photo_swfu = new PhotoUpload("script/swfupload_f9.swf","$very[url]/upload.php?tid=" + tid);
}

var removeRid = '';
function removeRes(rid)
{
	var con = confirm("您确认要从本{$very[contentName]}中移除此资源么？");
	if(!con) return false;
	var xhr = new XHR('removeRes2');
	var url = 'upload.php?action=removeRes&rid='+rid + '&tid=' + tid;
	//alert(url);
	xhr.get(url);
	removeRid = rid;
}

function removeRes2(msg)
{
	//alert(msg);
	if(msg == 1)
	{
		var inputTable = document.getElementById('resourceTbody');
		var resTr = document.getElementById('res_'+removeRid);
		inputTable.removeChild(resTr);
	}
}


function checkRes()
{
	if(document.getElementById('mulu').value == '')
	{
		alert('请选择一个有效目录');
		return false;
	}
	if(document.getElementById('title').value.length < 2)
	{
		alert('{$very[contentName]}标题为空或者长度小于2，请务必填写此项。');
		document.getElementById('title').focus();
		return false;
	}
	$('#upbtn').attr("disable", "disabled");

}

function IsBrowser(){
	var sAgent = navigator.userAgent.toLowerCase() ;
	// Internet Explorer
	if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 )
		return "msie" ;

	// Gecko (Opera 9 tries to behave like Gecko at this point).
	if ( navigator.product == "Gecko" && !( typeof(opera) == 'object' && opera.postError ) )
		return "gecko";

	// Opera
	if ( navigator.appName == 'Opera')
		return "opera" ;

	// Safari
	if ( sAgent.indexOf( 'safari' ) != -1 )
		return "safari";

	return false ;
}

function selectImg(inputname){
	if(IsBrowser()=='msie'){
		showModalDialog("$basename&action=addimage&inputtype=input&inputname="+inputname,window,'dialogWidth=650px;dialogHeight=500px;help:no;status:no;');
	}else{
		window.open("$basename&action=addimage&inputtype=input&inputname="+inputname,'','width=650,height=500,status=no');
	}
}
var tagid = document.FORM.tagsid;
var tagname;
var tags;
function SelectTag(tag,id){
	tagname = tag;
	var newid = parseInt(id);
	if(tagid.value.indexOf(newid)=='-1'){
		tagid.value+=newid+',';
		document.getElementById('tags_show').innerHTML+="<A href=\"javascript:deltag("+newid+",'"+tagname+"');\">"+tagname+"</A>   ";
	}
}

function SearchTag(evt){
	e=catchKeyCode(evt);
	if(e==13){
		addtag();
	}else{
		tagname = document.FORM.tags.value;
		tagname=tagname.replace(/(^\s*)|(\s*$)/g, "").replace(/\s+/g," ");
		tags = tagname.split(" ");
		if(tags[tags.length-1].length>0){
			var xhr = new XHR('ShowSearchTag');
			var url = '$basename&action=SearchTag&tagname='+encodeURI(tags[tags.length-1]);
			xhr.get(url);
		}else{
			document.getElementById('showtags').style.display ='none';
		}
	}
}

function ShowSearchTag(ret){
	var st = document.getElementById('showtags');
	if(ret!='error'){
		st.innerHTML=ret;
		st.style.display ='block';
	}else{
		st.innerHTML='';
		st.style.display ='none';
	}
}

function catchKeyCode(evt){
	evt=window.event||evt;
	var ret=evt.keyCode?evt.keyCode:evt.which;
	return ret;
}

function addtag(){
	var j=0;
	tagname = document.FORM.tags.value;
	tagname=tagname.replace(/(^\s*)|(\s*$)/g, "").replace(/\s+/g," ");
	tags = tagname.split(" ");
	for(i in tags){
		if(tags[i].length<=1){
			alert('每一个标签(tag)必须由两个以上的字符组成');
			return false;
		}
	}
	var xhr = new XHR('showtag');
	var url = '$basename&action=tags&tagname='+encodeURI(tagname);
	xhr.get(url);
}

function showtag(ret){
	var newid = ret.split(',');
	for(i in tags){
		if(tagid.value.indexOf(newid[i]+',')=='-1'){
			tagid.value+=newid[i]+',';
			var browser = IsBrowser();
			document.getElementById('tags_show').innerHTML+="<A href=\"javascript:deltag("+newid[i]+",'"+tags[i]+"');\">"+tags[i]+"</A>   ";
			document.FORM.tags.value='';
		}
	}
}

function deltag(id,tagname){
	var ss=id+',';
	var nn;
	var browser = IsBrowser();
	if(browser=='msie' || browser=='opera'){
		nn="<A href=\"javascript:deltag("+id+",'"+tagname+"');\">"+tagname+"</A>";
	}else{
		nn="<a href=\"javascript:deltag("+id+",'"+tagname+"');\">"+tagname+"</a>";
	}
	var valueNow = tagid.value.replace(ss,' ');
	var tagNow = document.getElementById('tags_show').innerHTML.replace(nn,' ');
	document.getElementById('tags_show').innerHTML = tagNow;
	tagid.value=valueNow;
	document.FORM.tags.value=tagname;
}

function selectValue(inputname,value){
	if(value!=''){
		document.getElementById(inputname).value=value;
	}
}

function showColor(showName,inputName){
	var menu_editor = getObj("menu_editor");
	var colors = [
		'000000','660000','663300','666600','669900','66CC00','66FF00','666666','660066','663366','666666',
		'669966','66CC66','66FF66','CCCCCC','6600CC','6633CC','6666CC','6699CC','66CCCC','66FFCC','FF0000',
		'FF0000','FF3300','FF6600','FF9900','FFCC00','FFFF00','0000FF','FF0066','FF3366','FF6666','FF9966',
		'FFCC66','FFFF66','00FFFF','FF00CC','FF33CC','FF66CC','FF99CC','FFCCCC','FFFFCC'
	];
	var html = '<div id="colorbox">';
	for(i in colors){
		html += "<div unselectable=\"on\" style=\"background:#" + colors[i] + "\" onClick=\"SetC('" + colors[i] + "','" + inputName + "')\"></div>";
	}
	html += '</div>';
	menu_editor.innerHTML = html;
	if(typeof type == 'undefined'){
		click_open('menu_editor',showName,'2');
	} else{
		mouseover_open('menu_editor',showName,'2');
	}
}
function SetC(color,inputName){
	//var textValue = document.getElementById(inputName).value;
	//document.getElementById(inputName).value = "<span style=\"color:#"+color+";\">"+textValue+"</span>";
	document.getElementById(inputName).value = "#"+color;
	closep();
}

</script>
<!---main----foot-->
<!--# include Template('foot');#-->
